/*
 * Copyright (c) 2022  by Junzhao
 * THIS FILE IS PART OF JAVASE Song Huongkang PROJECT
 * All Rights Reserved.
 */

package 重写方法抛出规则;

import java.io.IOException;

/**
 * @description 子类重写方法异常不大于父类
 *              （ 由于多态存在 ）
 *              父类方法没有写异常 子类也不可以
 * @author 俊昭
 * @date 2022/4/11
*/

public class OverrideTest {
    public static void main(String[] args) {
        OverrideTest test = new OverrideTest();
        test.display(new SubClass());

    }
    public void display(SuperClass s){
        try {
            s.method1();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
class SuperClass{
    public void method1() throws IOException{

    }
}

class SubClass extends SuperClass{
    @Override
    public void method1(){

    }
}